package cn.stylefeng.guns.modular.business.frequency.orderbonus.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderbonus.service.OrderBonusService;
import cn.stylefeng.guns.modular.business.frequency.orderbonus.model.param.OrderBonusParam;

import javax.annotation.Resource;

/**
 * 奖金记录表(activityMq异步处理) 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:16
 */
@RestController
public class OrderBonusController {

    @Resource
    private OrderBonusService orderBonusService;

    /**
     * 分页查询奖金记录表(activityMq异步处理)
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderBonus/page")
    @BusinessLog(title = "奖金记录表(activityMq异步处理)_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderBonusParam orderBonusParam) {
        return new SuccessResponseData(orderBonusService.page(orderBonusParam));
    }

    @PostMapping("/orderBonus/appPage")
    @BusinessLog(title = "app我的业绩", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData appPage(@RequestBody OrderBonusParam orderBonusParam) {
        return orderBonusService.appPage(orderBonusParam);
    }

    @PostMapping("/orderBonus/appDetail")
    @BusinessLog(title = "app我的业绩", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData appDetail(@RequestBody OrderBonusParam orderBonusParam) {
        return orderBonusService.appDetail(orderBonusParam);
    }



    @PostMapping("/orderBonus/statistics")
    @BusinessLog(title = "app我的业绩统计", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData statistics(@RequestBody OrderBonusParam orderBonusParam) {
        return orderBonusService.statistics(orderBonusParam);
    }



    /**
     * 获取全部奖金记录表(activityMq异步处理)
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderBonus/list")
    @BusinessLog(title = "奖金记录表(activityMq异步处理)_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderBonusParam orderBonusParam) {
        return new SuccessResponseData(orderBonusService.list(orderBonusParam));
    }

    /**
     * 查看详情奖金记录表(activityMq异步处理)
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderBonus/detail")
    @BusinessLog(title = "奖金记录表(activityMq异步处理)_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderBonusParam.detail.class) OrderBonusParam orderBonusParam) {
        return new SuccessResponseData(orderBonusService.detail(orderBonusParam));
    }

    /**
     * 添加奖金记录表(activityMq异步处理)
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderBonus/add")
    @BusinessLog(title = "奖金记录表(activityMq异步处理)_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderBonusParam.add.class) OrderBonusParam orderBonusParam) {
        orderBonusService.add(orderBonusParam);
        return new SuccessResponseData();
    }

    /**
     * 删除奖金记录表(activityMq异步处理)
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderBonus/delete")
    @BusinessLog(title = "奖金记录表(activityMq异步处理)_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderBonusParam.delete.class) OrderBonusParam orderBonusParam) {
        orderBonusService.delete(orderBonusParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑奖金记录表(activityMq异步处理)
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderBonus/edit")
    @BusinessLog(title = "奖金记录表(activityMq异步处理)_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderBonusParam.edit.class) OrderBonusParam orderBonusParam) {
        orderBonusService.edit(orderBonusParam);
        return new SuccessResponseData();
    }

    /**
     * 修改状态
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderBonus/changeStatus")
    @BusinessLog(title = "奖金记录表(activityMq异步处理)_修改状态", opType = LogAnnotionOpTypeEnum.CHANGE_STATUS)
    public ResponseData changeStatus(@RequestBody @Validated(OrderBonusParam.changeStatus.class) OrderBonusParam orderBonusParam) {
        orderBonusService.changeStatus(orderBonusParam);
        return new SuccessResponseData();
    }

}
